package com.ruoyi.yijing.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yijing.mapper.YjBookChapterMapper;
import com.ruoyi.yijing.domain.YjBookChapter;
import com.ruoyi.yijing.service.IYjBookChapterService;

/**
 * 书本章节Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-22
 */
@Service
public class YjBookChapterServiceImpl implements IYjBookChapterService 
{
    @Autowired
    private YjBookChapterMapper yjBookChapterMapper;

    /**
     * 查询书本章节
     * 
     * @param chapterId 书本章节主键
     * @return 书本章节
     */
    @Override
    public YjBookChapter selectYjBookChapterByChapterId(Long chapterId)
    {
        return yjBookChapterMapper.selectYjBookChapterByChapterId(chapterId);
    }

    /**
     * 查询书本章节列表
     * 
     * @param yjBookChapter 书本章节
     * @return 书本章节
     */
    @Override
    public List<YjBookChapter> selectYjBookChapterList(YjBookChapter yjBookChapter)
    {
        return yjBookChapterMapper.selectYjBookChapterList(yjBookChapter);
    }

    /**
     * 新增书本章节
     * 
     * @param yjBookChapter 书本章节
     * @return 结果
     */
    @Override
    public int insertYjBookChapter(YjBookChapter yjBookChapter)
    {
        yjBookChapter.setCreateTime(DateUtils.getNowDate());
        yjBookChapter.setCreateBy(SecurityUtils.getUsername());
        return yjBookChapterMapper.insertYjBookChapter(yjBookChapter);
    }

    /**
     * 修改书本章节
     * 
     * @param yjBookChapter 书本章节
     * @return 结果
     */
    @Override
    public int updateYjBookChapter(YjBookChapter yjBookChapter)
    {
        yjBookChapter.setUpdateTime(DateUtils.getNowDate());
        yjBookChapter.setUpdateBy(SecurityUtils.getUsername());
        return yjBookChapterMapper.updateYjBookChapter(yjBookChapter);
    }

    /**
     * 批量删除书本章节
     * 
     * @param chapterIds 需要删除的书本章节主键
     * @return 结果
     */
    @Override
    public int deleteYjBookChapterByChapterIds(Long[] chapterIds)
    {
        return yjBookChapterMapper.deleteYjBookChapterByChapterIds(chapterIds);
    }

    /**
     * 删除书本章节信息
     * 
     * @param chapterId 书本章节主键
     * @return 结果
     */
    @Override
    public int deleteYjBookChapterByChapterId(Long chapterId)
    {
        return yjBookChapterMapper.deleteYjBookChapterByChapterId(chapterId);
    }
}
